package com.wfs.util;

import java.io.IOException;

import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.Sender;

public class GCMServiceUtil {
	
	public static final String GCM_API_KEY = "AIzaSyAmWlAsldKd394ekWWUQHdzsHtmvWJjXo0";
	
	public static boolean sendMessage(String device_rid, String message){
		try {
			Sender s = new Sender(GCM_API_KEY);
			Message m = new Message.Builder().collapseKey("1").timeToLive(3).delayWhileIdle(true).addData("message", message).build();
			s.send(m, device_rid, 1);
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}

}
